Copyright ã1995 by NeXT Computer, Inc.  All Rights Reserved.

NS_DEV_DOCFOR:objc_class:NXBrowserCell;,NXBrowserCell

Inherits From:	Cell : Object

Declared In:	appkit/NXBrowserCell.h

Class Description

NXBrowserCell is the subclass of Cell used by default to display data in the column Matrices of NXBrowser.  Many of NXBrowserCell's methods are designed to interact with NXBrowser and NXBrowser's delegate.  The delegate implements methods for loading the Cells in NXBrowser by setting their values and status.  If your code needs access to a specific NXBrowserCell, you can use the NXBrowser method getLoadedCellAtRow:inColumn:.

You may find it useful to create a subclass of NXBrowserCell to alter its behavior and to enable it to work with and display the type of data you wish to represent.  Use NXBrowser's setCellClass: or setCellPrototype: methods to have it use your subclass.

See the NXBrowser class specification for more details.  In particular, the ªMethods Implemented by the Delegateº section describes how the NXBrowser's delegate interacts with both NXBrowser and NXBrowserCells.  

Instance Variables

None declared in this class.

Method Types

Initializing and freeing an NXBrowserCell
- init
- initTextCell:
- free

Determining component sizes	- calcCellSize:inRect:

Accessing graphic attributes	- isOpaque
- setImage:
- image
- setAltImage:
- altImage
+ branchIcon
+ branchIconH

Displaying	- drawInside:inView:
- drawSelf:inView:
- highlight:inView:lit:

Placing in browser hierarchy	- setLeaf:
- isLeaf

Determining loaded status	- setLoaded:
- isLoaded

Setting state	- set
- reset

Class Methods

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-branchIcon];,branchIcon

+ branchIcon

Returns the NXImage object named ªNXmenuArrowº.  This is the icon displayed to indicate a branch node in an NXBrowserCell.  Override this method if you want your subclass to display a different branch icon.

See also:  - isLeaf

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-branchIconH];,branchIconH

+ branchIconH

Returns the NXImage object named ªNXmenuArrowHº.  This is the highlighted icon displayed to indicate a selected branch node in an NXBrowserCell.  Override this method if you want your subclass to display a different branch icon.

See also:  - isLeaf

Instance Methods

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-altImage];,altImage

- altImage

Returns the NXImage that appears on the NXBrowserCell when it's in its alternate state, or nil if there's no such image. 

See also:  - setAltImage:, - setImage, - image

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-calcCellSize:inRect:];,calcCellSize:inRect:

- calcCellSize:(NXSize *)theSize inRect:(const NXRect *)aRect

Returns self, and, by reference in theSize, the minimum width and height required for displaying the NXBrowserCell in a given rectangle.  Makes sure theSize remains large enough to accommodate the branch arrow icon.  If it isn't possible for the NXBrowserCell to fit in aRect, the width or height returned in theSize could be bigger than those of the rectangle.  Returns self.

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-drawInside:inView:];,drawInside:inView:

- drawInside:(const NXRect *)cellFrame inView:aView

Draws the inside of the NXBrowserCell.  Unlike other Cells, NXBrowserCell never draws a border or bezel.  Override this method to draw the cell differently.  Returns self.

See also:  - drawSelf:inView:

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-drawSelf:inView:];,drawSelf:inView:

- drawSelf:(const NXRect *)cellFrame inView:aView

Draws the inside of the NXBrowserCell by invoking drawInside:inView:.  Unlike other Cells, NXBrowserCell never draws a border or bezel.  Returns self.

See also:  - drawInside:inView:

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-free];,free

- free

Frees the memory used by the NXBrowserCell.  If an image has been set using setImage:, it's also freed.  The alternate imageÐif anyÐis not freed.

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-highlight:inView:lit:];,highlight:inView:lit:

- highlight:(const NXRect *)cellFrame inView:aView lit:(BOOL)lit

If the highlighted state would change, sets the NXBrowserCell's highlighted state to lit and redraws it if needed within cellFrame in aView.  Override this method to highlight the NXBrowserCell differently.  Returns self.

See also:  - set, - reset, - highlight:inView:lit: (Cell)

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-image];,image

- image

Returns the NXImage that was set with the setImage: method, or nil if no such image has been set.  

See also:  - setImage:, - setAltImage:, - altImage

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-init];,init

- init

Initializes and returns the receiver, a new NXBrowserCell instance, sets its title to ªBrowserItemº and returns self.

See also:  - initTextCell:

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-initTextCell:];,initTextCell:

- initTextCell:(const char *)aString

Initializes the receiver, a new NXBrowserCell instance with aString as its title.  Sets the NXBrowserCell so it doesn't wrap text.  This method is the designated initializer for the NXBrowserCell class.  Override this method if you create a subclass of NXBrowserCell that performs its own initialization.  Returns self.

See also:  - init

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-isLeaf];,isLeaf

- (BOOL)isLeaf

Determines whether the entry in the receiver represents a leaf node (such as a file) or branch node (such as a directory).  This method is invoked by NXBrowser to check whether to display the branch icon in the Cell and, when an NXBrowserCell is selected, whether to load a column to the right of the column containing the receiving Cell.  Returns YES if the cell represents a leaf, NO if the cell represents a branch.

See also:  - setLeaf:

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-isLoaded];,isLoaded

- (BOOL)isLoaded

Returns YES if the NXBrowserCell is loaded, NO if it isn't.  Used by NXBrowser to determine if a particular Cell is loaded in a column.  When an NXBrowserCell is created, this value is YES; however, if the NXBrowserCell is created by the NXBrowser, it sets the value to NO so the delegate can properly set the loaded status.  NXBrowser and its delegate change the value returned by this method using the setLoaded: method to reflect the current status of the cell.

See also:  - setLoaded:, NXBrowser 

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-isOpaque];,isOpaque

- (BOOL)isOpaque

Returns YES since an NXBrowserCell is always opaque.

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-reset];,reset

- reset

Sets the NXBrowserCell's state to 0 and sets the highlighted flag to NO.  Does not display the NXBrowserCell, even if autodisplay is on.  Returns self.

See also:  - set, - highlight:inView:lit

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-set];,set

- set

Sets the NXBrowserCell's state to 1 and sets the highlighted flag to YES.  Does not display the NXBrowserCell, even if autodisplay is on.  Returns self.

See also:  - reset, - highlight:inView:lit

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-setAltImage:];,setAltImage:

- setAltImage:altImage

Sets the NXBrowserCell's alternate image to altImage.  If one has been set, the alternate image is displayed when an NXBrowserCell is highlighted.   

This method frees the previous alternate imageÐif anyÐbefore the new image is set.  Consequently, if you will be resetting the alternate image and you don't want a particular image freed, use a copy:

[theCell setAltImage:[[NXImage findImageNamed:ºsharedImageº] copy]];

See also:  - altImage, - setImage:, - image

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-setImage:];,setImage:

- setImage:image

Sets the NXBrowserCell's normal image to image.  The normal image is displayed when the NXBrowserCell is in the unhighlighted state.  In the highlighted state, it displays the alternate image (see setAltImage:) if one exists, or a highlighted version of the normal image, if not.

This method frees the previous imageÐif anyÐbefore the new image is set.  Consequently, if you will be resetting an NXBrowserCell's image and you don't want a particular image freed, use a copy:

[theCell setImage:[[NXImage findImageNamed:ºsharedImageº] copy]];

See also:  - image, - setAltImage:, - altImage

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-setLeaf:];,setLeaf:

- setLeaf:(BOOL)flag

Invoked by NXBrowser's delegate when it loads an NXBrowserCell.  If flag is YES, the NXBrowserCell is set to represent a leaf node; it will display without the branch icon.  When flag is NO, the NXBrowserCell is set to represent a branch node; it will display with the branch icon.  Does not display the NXBrowserCell, even if autodisplay is on.  Returns self.

See also:  - isLeaf, - branchIcon, - branchIconH

NS_DEV_DOCFOR:objc_method:[NXBrowserCell-setLoaded:];,setLoaded:

- setLoaded:(BOOL)flag

Sets the loaded status of the NXBrowser cell to flag.  This method is invoked by NXBrowser or its delegate to set the status of the NXBrowserCell.  The delegate should send the setLoaded: message with YES as the argument when it loads the cell.

See also:  - isLoaded, NXBrowser delegate methods